home *** CD-ROM | disk | FTP | other *** search
- Path: keats.ugrad.cs.ubc.ca!not-for-mail
- From: c2a192@ugrad.cs.ubc.ca (Kazimir Kylheku)
- Newsgroups: comp.lang.c
- Subject: Re: What does the -O option do???!!!
- Date: 11 Feb 1996 11:59:45 -0800
- Organization: Computer Science, University of B.C., Vancouver, B.C., Canada
- Message-ID: <4flhrhINNtj@keats.ugrad.cs.ubc.ca>
- References: <4ehger$cj9@mark.ucdavis.edu> <823827008snz@genesis.demon.co.uk> <4fiphrINNrvr@keats.ugrad.cs.ubc.ca> <9602102332.AA09466@dxmint.cern.ch>
- NNTP-Posting-Host: keats.ugrad.cs.ubc.ca
-
- In article <9602102332.AA09466@dxmint.cern.ch>,
- Dan Pop <danpop@mail.cern.ch> wrote:
- >c2a192@ugrad.cs.ubc.ca (Kazimir Kylheku) writes:
- >
- >>... as long as it is not hard-coded to treat identifiers like "free" specially.
- >
- >A compiler is free to treat identifiers like "free" specially after the
- >relevant header has been included.
- >
- >>If you write your own free() with different semantics, you would not want the
- >>compiler messing with that.
- >
- >If you write your own free() you invoke undefined behaviour and you can't
- >expect the compiler to behave in a sensible way. The implementation
- >namespace is a big taboo in C.
-
- Are you serious? What if I'm writing a little embedded kernel that doesn't use
- anything resembling the standard C library, and I use free() for something
- quite different?
-
- This is truly silly. The standard may say one thing, but it's despicable to
- actually implement a compiler that treats free() specially. There is nothing in
- the semantics of free() that requires special treatment in order to do its job.
-
- For one thing, malloc() is far from a perfect allocation scheme, so why give it
- preferential treatment? I might design my own library which uses allocation
- handles, and performs heap compaction, for instance.
-
- >>It's just another function, after all.
- >
- >No, it isn't. Have a look at the standard.
-
- I just had a look at the sources for my standard library. It sure looks like a
- function to me. (Walks like a duck, quacks like a duck, ... )
-
- I wonder whether the seats of that ANSI commitee were actually populated by
- programmers.
- --
-
-